<?php
require_once('../../../../conf/config.php.inc');
require_once(SYBMAS_LIB_PATH.'/liblogin.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/layout.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybmas.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/menu.php.inc');
require_once('../../lib/libtablas.php.inc');
verificar_inicio_sesion();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css"
	href="<?php echo LAYOUT_URI?>/sybmasstyle.css">
<script src="<?php echo LAYOUT_URI?>/jquery-1.2.1.min.js"
	type="text/javascript"></script>
<script src="<?php echo LAYOUT_URI?>/menu-collapsed.js"
	type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
	href="<?php echo LAYOUT_URI?>/style.css" >
<link rel="stylesheet" type="text/css"
	href="<?php echo JAVASCRIPT_URI?>/tabs/tabs.css">
<script src="<?php echo JAVASCRIPT_URI?>/tabs/tabs.js"
	type="text/javascript"></script>
<title>.:: Sybmas - Detalle de tabla</title>
<!--[if lt IE 8]>
   <style type="text/css">
   li a {display:inline-block;}
   li a {display:block;}
   </style>
   <![endif]-->
</head>
<body>
<script src="<?php echo JAVASCRIPT_URI?>/tooltip/wz_tooltip.js"
	type="text/javascript"></script>
<center>
<div id="container">
<div id="header"><?php generar_header();?></div>
<div id="scene">
<div id="modulos">
<ul id="menu" style="width: 150px;">
<?php generar_menu();?>
</ul>
</div>

<div id="title">Confirmacion de borrado de tabla</div>
<div id="main"><?php 
$dbname=false;
if(array_key_exists('dbname',$_GET)){
	$dbname=$_GET['dbname'];
}
$id=$_GET['id'];
$tablename='';
?> <?php
$cambio_bd_exitoso=true;
$sybuser_connection=start_default_sybuser_connection();
if($dbname){
	$cambio_bd_exitoso=sybase_select_db($dbname,$sybuser_connection);
}

if($cambio_bd_exitoso){
	$query="SELECT o.id,o.name, o.crdate, u.name AS owner ,s.name AS segment ".
		"FROM sysobjects o, sysusers u, syssegments s, sysindexes i ".
		"WHERE o.id=$id ".
		"AND i.indid<2 ".
		"AND o.uid=u.uid ".
		"AND i.id=o.id ".
		"AND i.segment=s.segment";

	$result=sybase_query($query,$sybuser_connection);
	$data=sybase_fetch_array($result);
	$tablename=$data['name'];
	?>

<h1>¿Desea continuar con la eliminacion de la tabla <b><?php echo $tablename;?></b>?</h1>

<table width="80%" border="1">
	<tr>
		<th>id</th>
		<td><?php echo $data['id']?></td>
	</tr>
	<tr>
		<th>base de datos</th>
		<td><?php echo !empty($dbname)?$dbname:$_SESSION['sybmas.user.dbname']?></td>
	</tr>
	<tr>
		<th>nombre</th>
		<td><?php echo $data['name']?></td>
	</tr>
	<tr>
		<th>propietario</th>
		<td><?php echo $data['owner']?></td>
	</tr>
	<tr>
		<th>fecha creacion</th>
		<td><?php echo $data['crdate']?></td>
	</tr>
	<tr>
		<th>segmento</th>
		<td><?php echo $data['segment'];?></td>
	</tr>

</table>
<?php	
}//if($cambio_bd_exitoso)
?> <?php
//Cerrando conexiones a la base de datos
sybase_close($sybuser_connection);
?>
<hr>
<div align="left">
<form method="post" action="tabla2.php">
	<input type="hidden" name="tablename" value="<?php echo $tablename?>">
	<?php if($dbname){?>
	<input type="hidden" name="dbname" value="<?php echo $dbname?>" >
	<?php }?>
	<input type="submit" value="Eliminar tabla">
	<input type="button" value="Cancelar" onclick="history.back()" >
</form>
</div>


</div>
<!-- main --></div>
<!-- scene --> <?php generar_footer();?></div>
</center>
</body>
</html>
